TableDetail

查询指定表的详细信息

请求地址

POST
http://OmsAddress/app/newoms.php/webservice/business/table/detail?cmd=10006&ip-type=webservicerest&access-token=AccessTokenVal

POST请求参数说明

参数名称 数据类型 说明 是否必填字段 备注
app_id 整型 table所在的业务的app_id
zone_id 整型 table所在的zone的zone_id
table_name 字符串 table名称
get_table_attachs 整型,0或1 是否获取加表使用的文件列表(包含文件id、文件名称、文件内容),若不需要,建议置为0 否,默认值0 无论加表文件的编码格式,此处返回的内容都是utf8编码的
get_table_struct 整型,0或1 是否获取表的结构体信息,若不需要,建议置为0 否,默认值0 使用proto文件定义的表还不支持此功能

Data参数

使用json格式表示记录相关信息,示例如下:

{
    "app_id": "2",
    "zone_id": 3,
    "table_name": "list_tb",
    "get_table_attachs": 1,
    "get_table_struct": 1
}

返回语法

返回参数说明

  1. 返回状态码不为200时,表示查询失败,返回数据为错误信息

  2. 返回状态码为200,表示查询成功,返回指定set_id,app_id的信息

请求示例

通过 curl 方法发起请求

命令中的参数请参考本页中的“POST请求参数说明”,access-token的获取方法详见:获取access-token

curl -H "Content-type: application/json" -X "POST" -d '{
    "app_id": "2",
    "zone_id": 3,
    "table_name": "list_tb",
    "get_table_attachs": 1,
    "get_table_struct": 1
}' 'http://omsaddress/app/newoms.php/webservice/business/table/detail?cmd=10006&ip-type=webservicerest&access-token=<access-token>'

返回示例

成功返回示例

http请求的Status=200

{
    "set_id": 1,
    "app_id": 2,
    "zone_id": 3,
    "table_name": "list_tb",
    "fmt_type": "tdr",
    "shard_factors": "uin",
    "table_type": 0,
    "table_maxnum": 0,
    "key_fields": "{\"Num\":2,\"KeyField\":[{\"Name\":\"uin\",\"Type\":\"int32\",\"MaxLen\":4},{\"Name\":\"name\",\"Type\":\"string\",\"MaxLen\":64}]}",
    "value_fields": "{\"Num\":3,\"ValueField\":[{\"Name\":\"level\",\"Type\":\"int32\",\"MaxLen\":4,\"Default\":\"1\"},{\"Name\":\"count\",\"Type\":\"uint8\",\"MaxLen\":1,\"Default\":\"0\"},{\"Name\":\"items\",\"Type\":\"array\",\"MaxLen\":80,\"Default\":\"\"}]}",
    "dm_ratio": 5,
    "create_date": "2021-06-28 16:50:21",
    "modify_date": "0000-00-00 00:00:00",
    "dbcluster_info": "{\"AppID\":2,\"ZoneID\":4,\"TableName\":\"table_test\",\"TableType\":0,\"DbSources\":{\"DbSourceNum\":1,\"DbSource\":[{\"DbSourceName\":\"DbSource\",\"Ip\":\"9.135.102.211\",\"Port\":3306,\"User\":\"tcaplus_dbuser\",\"Passwd\":\"OboxSEQqXa1pMmMaT0EJRg==\",\"DbName\":\"tcaplus_dbname\",\"ConnPoolSize\":10,\"CharacterSet\":\"utf8\"}]},\"DbTables\":{\"DbTableNum\":1,\"DbTable\":[{\"TablePrefix\":\"table_test_Z4_\",\"SubTableCount\":1,\"ValueFields\":{\"FieldNum\":3,\"Field\":[{\"FieldName\":\"level\",\"DbFieldName\":\"level\"},{\"FieldName\":\"count\",\"DbFieldName\":\"count\"},{\"FieldName\":\"items\",\"DbFieldName\":\"items\"}]},\"KeyFields\":{\"FieldNum\":2,\"Field\":[{\"FieldName\":\"uin\",\"DbFieldName\":\"uin\"},{\"FieldName\":\"name\",\"DbFieldName\":\"name\"}]},\"Deploy\":{\"SubTableStorePlaceNum\":1,\"SubTableStorePlace\":[{\"SubTableIndexStart\":0,\"SubTableIndexEnd\":1,\"DbSourceName\":\"DbSource\"}]}}]},\"FieldTypeStmts\":{\"TableTdrFile\":\"..\\/..\\/cfg\\/tcapdb_1_2_5_3\\/99ef1e51e751be07f16215bf71244305.tdr\",\"TableTdrName\":\"table_test\",\"KeyFieldStmts\":{\"FieldStmtNum\":0},\"ValueFieldStmts\":{\"FieldStmtNum\":0},\"TableIdlFile\":\"\",\"IdlType\":1},\"RouteKeyFields\":{\"FieldNum\":0},\"tdbank_conf\":{\"bid\":\"tcaplus\",\"tid\":\"tcaplus\",\"db_name\":\"tcaplus\",\"string_encode_manner\":1,\"msgtype\":2,\"tdbank_addr\":\"tcp:\\/\\/10.215.130.234:46801\"},\"DBType\":1,\"IndexInfo\":{\"ReplicationNum\":0,\"ShardNum\":0},\"PluginInfo\":{\"PluginName\":\"\",\"PluginFileID\":0,\"PluginFilePath\":\"\",\"WindowSize\":10,\"AlarmReceivers\":\"\"},\"KafkaInfo\":{\"Instance\":\"\",\"Address\":\"\",\"Topic\":\"\",\"User\":\"\",\"Password\":\"\"}}",
    "table_attachs": [],
    "table_struct_content": "",
    "global_index_struct": [
        {
            "FieldName": "uin",
            "DbFieldName": "uin"
        },
        {
            "FieldName": "name",
            "DbFieldName": "name"
        },
        {
            "FieldName": "level",
            "DbFieldName": "level"
        },
        {
            "FieldName": "count",
            "DbFieldName": "count"
        },
        {
            "FieldName": "items",
            "DbFieldName": "items"
        }
    ]
}

成功返回参数说明

参数名称 数据类型 说明
set_id 整型 游戏区所在的集群的id
app_id 整型 zone所在的业务的id
zone_id 整型 游戏区的id
table_name 字符串 表名
fmt_type 字符串 表结构文件类型(加表是用什么文件类型加表的)
shard_factors 字符串 分表因子
table_type 字符串 表类型,0代表是generic表,1代表是list表
table_maxnum 字符串 list表一条记录的最大数量,表类型为list时该参数有效
key_fields 字符串 表的key字段描述
value_fields 字符串 表的value字段描述
dm_ratio 整型 废弃字段,无需关注
create_date 字符串 表创建时间
modify_date 字符串 表变更时间
dbcluster_info 字符串 缓写相关信息
table_attachs 字符串 加表使用的文件列表,仅在请求中设置了get_table_attachs才有此字段内容返回
table_struct_content 字符串 表的结构体信息,仅在请求中设置了get_table_struct才有此字段内容返回。另外PB表不支持此字段
global_index_struct 字符串 全局索引字段映射信息

错误返回

http请求的Status!=200

{
    "name": "Unauthorized",
    "message": "You are requesting with an invalid credential.",
    "code": 0,
    "status": 401,
    "type": "yii\\web UnauthorizedHttpException"
}
{
    "table_name": [
        "can't find table(app_id:2,zone_id;3,table_name:list_tb123)"
    ]
}

results matching ""

    No results matching ""